/*
 * @lc app=leetcode.cn id=506 lang=cpp
 *
 * [506] 相对名次
 */

// @lc code=start
class Solution
{
public:
    static bool cmp(const vector<int> &a, const vector<int> &b)
    {
        return a[0] > b[0];
    }
    string myrank(int a)
    {
        switch (a)
        {
        case 0:
            return "Gold Medal";
        case 1:
            return "Silver Medal";
        case 2:
            return "Bronze Medal";
        default:
            return to_string(a+1);
        }
    }
    vector<string> findRelativeRanks(vector<int> &score)
    {
        //相对名次 score[i]表示第i名的得分
        vector<vector<int>> v;
        for (int i = 0; i < score.size(); i++)
        {
            v.push_back({score[i], i});
        }
        sort(v.begin(), v.end(), cmp);
        vector<string> res(score.size(), "");
        for (int i = 0; i < v.size(); i++)
        {
            res[v[i][1]] = myrank(i);
        }
        return res;
    }
};
// @lc code=end
